import React, { Component } from 'react'
const Fn = (Com)=> {
  // Fn就是高级组件，是一个函数，会返回一个新的组件
  return class extends Component {
    constructor() {
      super()
      this.state = {
        age: 18
      }
    }
    render() {
      return (
        <div>
          <p>我经过了加工----{this.state.age}</p>
          {<Com></Com>}
        </div>
      )
    }
  }
}
const ComA1 = () => {
  return (
    <>
    <p>我是ComA1</p>
    </>
  )
}
const ComA2 = () => {
  return (
    <>
    <p>我是ComA2</p>
    </>
  )
}
const ComAA = Fn(ComA1);
const ComAB = Fn(ComA2);
export default class HOC extends Component {
  render() {
    return (
      <div>
        <ComAA></ComAA>
        <ComAB></ComAB>
      </div>
    )
  }
}
